package cn.bonoon.entities;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import cn.bonoon.kernel.support.entities.AbstractPersistable;
import cn.bonoon.kernel.support.entities.Persistable;

/**
 * <pre>
 * 用于对某些实体进行评论、评分的操作记录
 * 
 * 规则：
 * 1.所有评论、评分的子类，必须继承本父类
 * 2.子类的类名不再以"XXXEntity"结尾，而应该以"XXXComment"结尾，表示评论、评分实体
 * 3.生成的表的名字则应该以"CT_XXX"开关
 * </pre>
 * @author jackson
 *
 */
@MappedSuperclass
public abstract class AbstractComment<E extends Persistable> extends AbstractPersistable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -5418815566988221199L;

	@Column(name = "C_CREATORID")
	private Long creatorId;
	@Column(name = "C_CREATORNAME")
	private String creatorName;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "C_CREATEAT", nullable = false)
	private Date createAt;
	@Column(name = "C_CONTENT")
	private String content;
	//给这道题目打的分数
	@Column(name = "C_SCORE")
	private int score;
	//状态：未审、正常、禁止
	@Column(name = "C_STATUS")
	private int status;
	/**
	 * 被评论的实体对象
	 */
	@ManyToOne
	@JoinColumn(name = "R_COMMENTED_ID")
	private E commented;

	public Long getCreatorId() {
		return creatorId;
	}
	public void setCreatorId(Long creatorId) {
		this.creatorId = creatorId;
	}
	public String getCreatorName() {
		return creatorName;
	}
	public void setCreatorName(String creatorName) {
		this.creatorName = creatorName;
	}
	public Date getCreateAt() {
		return createAt;
	}
	public void setCreateAt(Date createAt) {
		this.createAt = createAt;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public int getScore() {
		return score;
	}
	public void setScore(int score) {
		this.score = score;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public E getCommented() {
		return commented;
	}
	public void setCommented(E commented) {
		this.commented = commented;
	}
}
